<?php

/**
 * Links form base class.
 *
 * @method Links getObject() Returns the current form's model object
 *
 * @package    explications_informatiques
 * @subpackage form
 * @author     Guimezanes Cyrille
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseLinksForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idlinks'     => new sfWidgetFormInputHidden(),
      'titre'       => new sfWidgetFormInputText(),
      'url'         => new sfWidgetFormInputText(),
      'nbclick'     => new sfWidgetFormInputText(),
      'nbentree'    => new sfWidgetFormInputText(),
      'description' => new sfWidgetFormTextarea(),
      'img'         => new sfWidgetFormInputText(),
      'online'      => new sfWidgetFormInputText(),
      'last_ip'     => new sfWidgetFormInputText(),
      'token'       => new sfWidgetFormInputText(),
      'last_in'     => new sfWidgetFormDateTime(),
      'email'       => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'idlinks'     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idlinks')), 'empty_value' => $this->getObject()->get('idlinks'), 'required' => false)),
      'titre'       => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'url'         => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'nbclick'     => new sfValidatorInteger(array('required' => false)),
      'nbentree'    => new sfValidatorInteger(array('required' => false)),
      'description' => new sfValidatorString(array('required' => false)),
      'img'         => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'online'      => new sfValidatorString(array('max_length' => 1, 'required' => false)),
      'last_ip'     => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'token'       => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'last_in'     => new sfValidatorDateTime(array('required' => false)),
      'email'       => new sfValidatorString(array('max_length' => 100, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('links[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Links';
  }

}
